package com.system.role.entity;

import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.system.permission.entity.Permission;
import com.system.user.entity.User;

@Entity
@Table(name="t_role")
public class Role {
	private Long roleId;
	private String roleName;
	private String roleType;
	private List<Permission> permissionLists = new ArrayList<Permission>(); 
	private List<User> userLists = new ArrayList<User>();
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getRoleId() {
		return roleId;
	}
	public String getRoleName() {
		return roleName;
	}
	@ManyToMany(fetch=FetchType.EAGER)
	public List<Permission> getPermissionLists() {
		return permissionLists;
	}
	@JsonIgnore
	@OneToMany(mappedBy="role")
	public List<User> getUserLists() {
		return userLists;
	}
	
	public String getRoleType() {
		return roleType;
	}
	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	public void setPermissionLists(List<Permission> permissionLists) {
		this.permissionLists = permissionLists;
	}
	public void setUserLists(List<User> userLists) {
		this.userLists = userLists;
	}
	public void setRoleType(String roleType) {
		this.roleType = roleType;
	}
	
}
